package cn.edu.wynu.oop.day09;

public class Hero {

    // 属性
    int healthLife;
    int moveSpeed;

    // 方法
    void attack() {
        System.out.println("攻击了一个小兵！");
    }

    public static void main(String[] args) {
        Hero xiaoQiao = new Hero(1000, 345);
        xiaoQiao.attack();
        System.out.println("当前生命值：" + xiaoQiao.healthLife);
    }

    // 构造器:一种特殊的方法（方法名和类名一样）alt + insert 生成
    public Hero(int healthLife, int moveSpeed) {
        this.healthLife = healthLife;
        this.moveSpeed = moveSpeed;
    }

    public Hero(int healthLife) {
        this.healthLife = healthLife;
    }

    public Hero() {
    }
}
